package n01;

public class Rectangle { //矩形
	private int width, height;

	public void setWidth(int width) {
		this.width = width;
	}

	public void setHeight(int height) {
		this.height = height;
	}
	public int getArea() {
		return width*height;
	}
	public Rectangle() {
		
	}
	public Rectangle(int width, int height) {
		this.width = width;
		this.height = height;
	}
	public void showMessage() { //实例方法
		System.out.printf("Rectangle(width=%d, height=%d), Area=%d\n", width, height, getArea());
	}
	//方法重载
	public static void showMessage(int width, int height) { //利用静态方法显示指定宽高的矩形的信息
		Rectangle r = new Rectangle(width, height);
		r.showMessage();
//		System.out.printf("Rectangle(width=%d, height=%d), Area=%d\n", width, height, r.getArea());
	}
	public static void showMessage(Rectangle rectangle) { //利用静态方法显示指定矩形对象的信息
		rectangle.showMessage();
	}
}
